function t(t, a, e) {
    return a in t ? Object.defineProperty(t, a, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[a] = e, t;
}

var a = getApp();

Page({
    data: {
        memberType: 1,
        tip: "",
        topText: "",
        permission: {}
    },
    onLoad: function(t) {
        var a = t.memberType, e = "", o = "";
        1 == a ? (wx.setNavigationBarTitle({
            title: "团队管理员查档权限"
        }), e = "团队管理员可查看档期具体内容", o = "允许团队管理员查看档期") : (wx.setNavigationBarTitle({
            title: "团队成员查档权限"
        }), e = "团队成员可查看档期具体内容", o = "允许团队成员查看档期"), this.setData({
            tip: e,
            memberType: a,
            topText: o
        }), this.loadData();
    },
    loadData: function() {
        var t = this;
        a.network.post({
            url: a.url.getPermission,
            params: {},
            before: function() {
                wx.showNavigationBarLoading(), wx.showLoading({
                    title: "加载中"
                });
            },
            success: function(e) {
                wx.hideLoading(), 1 == e.data.result ? (console.log(e.data.data.permission), t.setData({
                    permission: e.data.data.permission
                })) : a.util.showToast(e.data.message);
            },
            fail: function() {
                wx.hideLoading(), a.util.showToast("获取失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading(), wx.stopPullDownRefresh();
            }
        });
    },
    updateData: function(e, o) {
        var i = this;
        a.network.post({
            url: a.url.updatePermission,
            params: t({
                id: i.data.permission.permissionId
            }, e, o),
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(t) {
                1 == t.data.result ? (console.log(t.data.data.permission), i.setData({
                    permission: t.data.data.permission
                })) : a.util.showToast(t.data.message);
            },
            fail: function() {
                a.util.showToast("获取团队信息失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading(), wx.stopPullDownRefresh();
            }
        });
    },
    checkboxChange: function(t) {
        var a = t.currentTarget.dataset.type;
        a = 1 == this.data.memberType ? "ta" + a : "tm" + a, console.log(a), console.log("switch1 发生 change 事件，携带值为", t.detail.value), 
        this.updateData(a, 1 == t.detail.value ? 1 : 0);
    },
    switchChange: function(t) {
        this.updateData(1 == this.data.memberType ? "taSchedule" : "tmSchedule", 1 == t.detail.value ? 1 : 0);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});